package com.bawei.park2211a.fg

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.bawei.base.mvvm.BaseFragment
import com.bawei.park2211a.R
import com.bawei.park2211a.adapter.MessageAdapter
import com.bawei.park2211a.databinding.FragmentMessageBinding
import com.bawei.park2211a.fg.msg.MsgViewModel
import com.bawei.park2211a.fg.notice.NoticeViewModel
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MessageFragment : BaseFragment<FragmentMessageBinding,MsgViewModel>() {
    lateinit var messageAdapter: MessageAdapter
    override fun initView() {
        viewModel.message(7,7)
        messageAdapter= MessageAdapter()
        binding.noticeRec.adapter=messageAdapter
        binding.noticeRec.layoutManager= LinearLayoutManager(requireContext())
    }

    override fun initData() {
        viewModel.messageSuccess.observe(this){
            messageAdapter.data.clear()
            messageAdapter.data.addAll(it)
            messageAdapter.notifyDataSetChanged()
        }
    }

}